#include <windowsx.h>
#include <objbase.h>
-#include "gdkdisplayprivate.h"
#include "gdkdevice-win32.h"
#include "gdkwin32.h"
+#include "gdkdisplay-win32.h"
G_DEFINE_TYPE (GdkDeviceWin32, gdk_device_win32, GDK_TYPE_DEVICE)
{
GdkDisplay *display = gdk_device_get_display (device);
- scale = GDK_WIN32_SCREEN (GDK_WIN32_DISPLAY (display)->screen)->window_scale;
+ scale = GDK_WIN32_DISPLAY (display)->window_scale;
hwnd = NULL;
}
#include "gdkwin32.h"
#include "gdkdevice-wintab.h"
-#include "gdkdisplayprivate.h"
+#include "gdkdisplay-win32.h"
G_DEFINE_TYPE (GdkDeviceWintab, gdk_device_wintab, GDK_TYPE_DEVICE)
{
GdkDisplay *display = gdk_device_get_display (device);
- scale = GDK_WIN32_SCREEN (GDK_WIN32_DISPLAY (display)->screen)->window_scale;
+ scale = GDK_WIN32_DISPLAY (display)->window_scale;
hwnd = NULL;
}
if (root_y)
*root_y = point.y / scale;
- if (hwn)
+ if (hwnd)
ScreenToClient (hwnd, &point);
if (win_x)
device_wintab->last_axis_data[i],
&axes[i]);
else
- _gdk_device_translate_screen_coord (device, window,
- root_x, root_y,
- GDK_WIN32_SCREEN (GDK_WIN32_DISPLAY (display)->screen)->width,
- GDK_WIN32_SCREEN (GDK_WIN32_DISPLAY (display)->screen)->height,
- i,
- device_wintab->last_axis_data[i],
- &axes[i]);
+ {
+ HMONITOR hmonitor;
+ MONITORINFO minfo = {sizeof (MONITORINFO),};
+
+ hmonitor = MonitorFromWindow (GDK_WINDOW_HWND (window),
+ MONITOR_DEFAULTTONEAREST);
+ GetMonitorInfo (hmonitor, &minfo);
+
+ /* XXX: the dimensions from minfo may need to be scaled for HiDPI usage */
+ _gdk_device_translate_screen_coord (device, window,
+ root_x, root_y,
+ minfo.rcWork.right - minfo.rcWork.left,
+ minfo.rcWork.bottom - minfo.rcWork.top,
+ i,
+ device_wintab->last_axis_data[i],
+ &axes[i]);
+ }
if (use == GDK_AXIS_X)
temp_x = axes[i];
else if (use == GDK_AXIS_Y)
ndevices, ncursors));
#endif
/* Create a dummy window to receive wintab events */
- wintab_window = gdk_window_new_popup (display, GDK_ALL_EVENTS_MASK, &(GdkRectangle) { -100, -100, 2, 2 });
+ wintab_window = gdk_window_new_popup (display, &(GdkRectangle) { -100, -100, 2, 2 });
g_object_ref (wintab_window);
for (devix = 0; devix < ndevices; devix++)
*/
#include "gdkdisplayprivate.h"
-#include "gdkscreen-win32.h"
#ifndef __GDK_DISPLAY__WIN32_H__
#define __GDK_DISPLAY__WIN32_H__
* data types, and file list dnd (which is handled seperately as it predates OLE2
* both in this implementation and on Windows in general).
*
- * As such, the data type conversion from gdk selection targets to OLE2 CF_* data
+ * As such, the data type conversion from gdk selection formats to OLE2 CF_* data
* type specifiers is partially hardwired. Fixing this is complicated by (a) the
* fact that the widget’s declared selection types aren’t accessible in calls here
* that need to declare the corresponding OLE2 data types, and (b) there isn’t a
}
static source_drag_context *
-source_context_new (GdkWindow *window,
- GList *targets)
+source_context_new (GdkWindow *window,
+ GdkContentFormats *formats)
{
GdkDragContext *context;
GdkWin32DragContext *context_win32;
g_object_ref (window);
result->context->dest_window = NULL;
- result->context->targets = g_list_copy (targets);
+ result->context->formats = gdk_content_formats_ref (formats);
context_win32->ole2_dnd_iface = (IUnknown *) &result->ids;
idropsource_addref (&result->ids);
POINT pt;
gint nfiles, i;
gchar *fileName, *linkedFile;
+ GPtrArray *formats;
+
+ formats = g_ptr_array_new ();
if (msg->message == WM_DROPFILES)
{
g_object_ref (context->dest_window);
/* WM_DROPFILES drops are always file names */
- context->targets =
- g_list_append (NULL, _text_uri_list);
+ g_ptr_array_add (formats, _text_uri_list);
+ context->formats = gdk_content_formats_new ((const char **) formats->pdata, formats->len);
+ g_ptr_array_unref (formats);
+
context->actions = GDK_ACTION_COPY;
context->suggested_action = GDK_ACTION_COPY;
current_dest_drag = context;
new_context->dest_window = context->dest_window;
g_object_ref (new_context->dest_window);
- new_context->targets = g_list_copy (context->targets);
+ new_context->formats = gdk_content_formats_ref (context->formats);
gdk_window_set_events (new_context->source_window,
gdk_window_get_events (new_context->source_window) |
}
GdkDragContext *
-_gdk_win32_window_drag_begin (GdkWindow *window,
- GdkDevice *device,
- GList *targets,
- gint x_root,
- gint y_root)
+_gdk_win32_window_drag_begin (GdkWindow *window,
+ GdkDevice *device,
+ GdkContentFormats *formats,
+ gint x_root,
+ gint y_root)
{
if (!use_ole2_dnd)
{
new_context->source_window = window;
g_object_ref (window);
- new_context->targets = g_list_copy (targets);
+ new_context->formats = gdk_content_formats_ref (formats);
new_context->actions = 0;
return new_context;
GDK_NOTE (DND, g_print ("gdk_drag_begin\n"));
- ctx = source_context_new (window, targets);
+ ctx = source_context_new (window, formats);
_dnd_source_state = GDK_WIN32_DND_PENDING;
/* stray GdkWindowImplWin32 members */
void _gdk_win32_window_register_dnd (GdkWindow *window);
-GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets, gint x_root, gint y_root);
+GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window,
+ GdkDevice *device,
+ GdkContentFormats *formats,
+ gint x_root,
+ gint y_root);
gint _gdk_win32_window_get_property (GdkWindow *window,
GdkAtom property,
sel_name);
g_free (sel_name);
- for (i = 0; i < n_targets; i++)
+ for (i = 0; i < ntargets; i++)
{
gchar *tgt_name = gdk_atom_name (targets[i]);
g_print ("%s", tgt_name);
g_free (tgt_name);
- if (i < n_targets - 1)
+ if (i < ntargets - 1)
g_print (", ");
}
g_print ("\n");
* support for it in Windows software, but note that alpha won't be
* handled.
*/
- for (i = 0; !has_image && i < n_targets; ++i)
+ for (i = 0; !has_image && i < ntargets; ++i)
{
UINT cf;
gchar *target_name;